package com.homework;

public class demo07 {
    public static void main(String[] args) {
        int count = getCount();
        System.out.println(getCount());
        for (int i = 0; i < getArr(count).length; i++) {
            System.out.print(getArr(count)[i]+" ");
        }
    }


    public static boolean isSXH(int num) {
        //获取num个十百位上的数字
        int ge = num % 10;
        int shi = num / 10 % 10;
        int bai = num / 100 % 10;
        if (ge * ge * ge + shi * shi * shi + bai * bai * bai == num) {
            return true;
        } else {
            return false;
        }
    }

    public static int getCount() {
        int count = 0;
        for (int i = 100; i < 1000; i++) {
            if (isSXH(i)) {
                count++;
            }
        }
        return count;
    }

    public static int[] getArr(int count) {
        int[] arr = new int[count];
        int index = 0;
        for (int i = 100; i <1000; i++) {
            if (isSXH(i)) {
                arr[index]=i;
                index++;
            }
        }
        return arr;
    }
}
